//
//  BusinessDataRequestManager.h
//  etionMisc
//
//  Created by wjxfhxy on 1/28/14.
//  Copyright (c) 2014 GuangZhouXuanWu. All rights reserved.
//

#import "XMSDataOperationManager.h"

@class XMSBusinessDataRequestManager;

@protocol XMSBusinessDataRequestManagerDelegate <XMSDataOperationManagerDelegate>

@optional

#pragma mark ------

- (void)beginProgressView:(XMSDataOperationManager *)dom funcationName:(NSString *)szFuncationname;

- (void)endProgressView:(XMSDataOperationManager *)dom funcationName:(NSString *)szFuncationname;

- (void)beginProgressView:(XMSDataOperationManager *)dom;

- (void)endProgressView:(XMSDataOperationManager *)dom;

- (void)holdProgressView:(XMSDataOperationManager *)dom delayTime:(NSTimeInterval)nDelay;

#pragma mark ------

- (void)beginProgressViewWithTip:(NSString *)tip;

#pragma mark ------

- (void)beginPullRefreshView:(XMSDataOperationManager *)dom;

- (void)beginPullRefreshView:(XMSDataOperationManager *)dom funcationName:(NSString *)szFuncationname;

- (void)endPullRefreshView:(XMSDataOperationManager *)dom;

- (void)endPullRefreshView:(XMSDataOperationManager *)dom funcationName:(NSString *)szFuncationname;

#pragma mark ------

- (void)beginPullLoadMoreView:(XMSDataOperationManager *)dom;

- (void)beginPullLoadMoreView:(XMSDataOperationManager *)dom funcationName:(NSString *)szFuncationname;

- (void)endPullLoadMoreView:(XMSDataOperationManager *)dom;

- (void)endPullLoadMoreView:(XMSDataOperationManager *)dom funcationName:(NSString *)szFuncationname;

#pragma mark ------

//- (void)requestComplete:(XMSDataOperationManager *)dom funcationName:(NSString *)szFuncationname result:(NSInteger)nResult output:(id)output error:(NSError *)error;


@end

@interface XMSBusinessDataRequestManager : XMSDataOperationManager
{
    NSTimeInterval _progressViewReleaseDelayTime;
    BOOL _maskOffProgressView;
}

@property(nonatomic, assign) NSTimeInterval progressViewReleaseDelayTime;
@property(nonatomic, assign) BOOL maskOffProgressView;
@property(nonatomic, assign) id<XMSBusinessDataRequestManagerDelegate> delegate;

#pragma mark ------

- (void)progressViewBegin:(NSString *)szFuncationname;

- (void)progressViewEnd:(NSString *)szFuncationname;

- (void)progressViewBegin;

- (void)progressViewEnd;

- (void)progressViewReleaseDelay;

- (void)progressViewReleaseDelay:(NSTimeInterval)nDelaytime handle:(void (^)())handle;

#pragma mark ------

- (void)progressViewBeginWithTip:(NSString*)tip;

#pragma mark ------

- (void)pullRefreshViewBegin;

- (void)pullRefreshViewBegin:(NSString *)szFuncationname;

- (void)pullRefreshViewEnd;

- (void)pullRefreshViewEnd:(NSString *)szFuncationname;

#pragma mark ------

- (void)pullLoadMoreViewBegin;

- (void)pullLoadMoreViewBegin:(NSString *)szFuncationname;

- (void)pullLoadMoreViewEnd;

- (void)pullLoadMoreViewEnd:(NSString *)szFuncationname;

#pragma mark ------

//此方法会在主线程中异步调用requestComplete:funcationName:result:output:error:
//- (void)requestCompletion:(NSString *)szFuncationname result:(NSInteger)nResult output:(id)output error:(NSError *)error;

- (void)requestResult:(NSInteger)nResult output:(id)output error:(NSError *)error completion:(void (^)(NSInteger nResult, id output, NSError *error))completion;

- (void)requestResult:(NSInteger)nResult bResult:(BOOL)bResult error:(NSError *)error completion:(void (^)(NSInteger nResult, BOOL bResult, NSError *error))completion;


- (void)requestResult:(NSInteger)nResult output:(id)output completion:(void (^)(NSInteger nResult, id output))completion;

- (void)requestResult:(NSInteger)nResult bResult:(BOOL)bResult completion:(void (^)(NSInteger nResult, BOOL bResult))completion;


@end
